﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - easyui</title>

    <environment include="Development">
        @*<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />*@
        <link rel="stylesheet" href="~/jquery-easyui-1.8.6/themes/bootstrap/easyui.css" />
        <link rel="stylesheet" href="~/jquery-easyui-1.8.6/themes/icon.css" />
        <link rel="stylesheet" href="~/easyui-icons/IconExtension.css" />
        <link rel="stylesheet" href="~/css/style.css" />
    </environment>
    <environment exclude="Development">
        @*<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
            asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
            asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute"
            crossorigin="anonymous"
            integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"/>*@
    </environment>
    @*<link rel="stylesheet" href="~/css/site.css" />*@
    <style>
        .tree-title {
            font-size: 14px;
        }
    </style>
</head>
<body>
        <div id="layout" class="easyui-layout" style="width:100%;height:100%">
            <div data-options="region:'north'" style="height:50px;"></div>
            <div data-options="region:'west',split:true,collapsible:true,title:'菜单'" style="width:240px;">
                <div id="menu" class="easyui-sidemenu" data-options="data:[],multiple:false" style="width:100%;padding:5px;">
                </div>
            </div>
            <div data-options="region:'center'">
                <div id="tt" class="easyui-tabs" style="width:100%;height:100%">
                    <div title="欢迎" style="padding:5px;">
                        <iframe src="home/index"></iframe>
                    </div>
                </div>
            </div>
            <div data-options="region:'south'" style="height:50px;"></div>
        </div>
        <environment include="Development">
            <script type="text/javascript" src="~/jquery-easyui-1.8.6/jquery.min.js" asp-append-version="false"></script>
            <script type="text/javascript" src="~/jquery-easyui-1.8.6/jquery.easyui.min.js" asp-append-version="false"></script>
            <script type="text/javascript" src="~/jquery-easyui-1.8.6/jquery-easyui-datagridview/datagrid-groupview.js" asp-append-version="false"></script>
            <script type="text/javascript" src="~/jquery-easyui-1.8.6/jquery-easyui-datagridview/datagrid-defaultview.js" asp-append-version="false"></script>
            <script type="text/javascript" src="~/jquery-easyui-1.8.6/jquery-easyui-datagridview/datagrid-scrollview.js" asp-append-version="false"></script>
            <script type="text/javascript" src="~/jquery-easyui-1.8.6/jquery-easyui-datagridview/datagrid-export.js" asp-append-version="false"></script>
            <script type="text/javascript" src="~/jquery-easyui-1.8.6/locale/easyui-lang-zh_CN.js" asp-append-version="false"></script>
        </environment>
        <environment exclude="Development">
            @*<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"
                        asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
                        asp-fallback-test="window.jQuery"
                        crossorigin="anonymous"
                        integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=">
                </script>
                <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"
                        asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"
                        asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
                        crossorigin="anonymous"
                        integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o">
                </script>*@
        </environment>


        <script type="text/javascript">
        $(function () {
            $.ajax({
                type: "GET",
                dataType: "json",
                url: "/Home/GetMenu",
                headers: { 'authorization': "Bearer " + localStorage.getItem('token')},
                success: function (data) {
                    console.info(data);
                    $("#menu").sidemenu({
                        data: data
                        ,onSelect: function (node) {
                            console.info(node)
                            if (node.children == null || node.children.length > 0) {
                                open1(JSON.parse(node.attributes).url, node.text);
                            }
                        }
                    });
                },
                error: function (e) {
                    console.info(e);
                }
            });

            $('#tt').tabs({
                onLoad: function (panel) {
                    var plugin = panel.panel('options').title;
                    panel.find('textarea[name="code-' + plugin + '"]').each(function () {
                        var data = $(this).val();
                        data = data.replace(/(\r\n|\r|\n)/g, '\n');
                        if (data.indexOf('\t') == 0) {
                            data = data.replace(/^\t/, '');
                            data = data.replace(/\n\t/g, '\n');
                        }
                        data = data.replace(/\t/g, '    ');
                        var pre = $('<pre name="code" class="prettyprint linenums"></pre>').insertAfter(this);
                        pre.text(data);
                        $(this).remove();
                    });
                    prettyPrint();
                }
            });
            $('#layout').layout('panel', "west").panel({
                onResize: function (w, h) {
                    $("#menu").sidemenu('resize',{width: w-10,height:'100%' });
                }
            });

        });
        function open1(plugin, pluginName) {
            if ($('#tt').tabs('exists', pluginName)) {
                $('#tt').tabs('select', pluginName);
            } else {
                var iframe = '<iframe src="/' + plugin + '" frameborder="0" style="border:0;width:100%;height:100%;"></iframe>';

                $('#tt').tabs('add', {
                    title: pluginName,
                    //href: plugin + '.html',
                    content: iframe,
                    closable: true,
                    bodyCls: 'content-doc',
                    /*extractor: function (data) {
                     data = $.fn.panel.defaults.extractor(data);
                     var tmp = $('<div></div>').html(data);
                     data = tmp.find('#content').html();
                     console.log(data);
                     tmp.remove();
                     return data;
                     }*/
                });
            }
        }
        </script>
        @RenderSection("Scripts", required: false)
</body>
</html>
